﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrainingWorkshop.Model;
using TrainingWorkshop.DALFactory;
using TrainingWorkshop.IDAL;

namespace TrainingWorkShop.BLL
{
    /// <summary>
    /// Author: Sissi Zeng
    /// Date:2012-08-19 14:40
    /// This class is use to get student list from factory
    /// by given condition
    /// </summary>
   public  class StudentBU
    {
       /// <summary>
       /// Constructor with no parameter
       /// </summary>
       public StudentBU()
       {
       
       }

       /// <summary>
       /// get all students from factory who take the course
       /// </summary>
       /// <param name="courseId">given courseId</param>
       /// <returns>list of student</returns>
       public List<Student> GetStudentsTakeCourse(int courseId) {
           IFactory factory = new ApplicationContext().CreateFactory("EF");
           IStudentRepository studentRep=factory.CreateStudentRepository();
            return  studentRep.StudentsTakeCourse(courseId);
       }

       public List<Student> GetStudentsNotTakeCourse(int courseId)
       {
           IFactory factory = new ApplicationContext().CreateFactory("EF");
           IStudentRepository studentRep = factory.CreateStudentRepository();
           return studentRep.StudentsNotTakeCourse(courseId);
       
       }
    }
}
